<template>
  <div class="module-header">
    <p class="module-name" :style="moduleNameCss">{{ moduleName }}</p>
    <p class="more" :style="moduleMoreCss">
      <span>{{ moreText }}</span>
      <i class="iconfont icon-weibiaoti-13"></i>
    </p>
    <div class="item-hover">
      <div class="edit-box" @click.stop="toModuleHeaderControl">
        <i class="iconfont icon-mokuai-bianji"></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    moduleName: {
      type: String,
      default: "",
    },
    moreText: {
      type: String,
      default: "更多",
    },
    propsData: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {};
  },
  mounted() {},
  watch: {},
  computed: {
    moduleNameCss() {
      return this.propsData.params.moduleNameCss || "";
    },
    moduleMoreCss() {
      return this.propsData.params.moduleMoreCss || "";
    },
  },
  methods: {
    toModuleHeaderControl() {
      let data = Object.assign({}, this.propsData);
      data.controlComName = "editModuleHeader";
      this.$emit("editModuleHeader", data);
    },
  },
};
</script>

<style lang="scss" scoped>
.module-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  .module-name {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 0;
  }
  .more {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 400;
    color: #888888;
    margin-bottom: 0;
    line-height: 1;
    .iconfont {
      font-size: 12px;
      margin-left: 2px;
      transform: scale(0.8);
    }
  }
  .item-hover {
    width: 100%;
    height: 100%;
    border: 1px solid #1890fc;
    position: absolute;
    left: 0;
    top: 0;
    display: none;
    .edit-box {
      width: 20px;
      height: 20px;
      background: #1890fc;
      border-radius: 0px 0px 0px 4px;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      position: absolute;
      right: 0;
      top: 0;
      .iconfont {
        font-size: 18px;
        color: #ffffff;
      }
    }
  }
}
.module-header:hover > .item-hover {
  display: block;
}
</style>
